<?

/**
 *  this class provides basic session handling functions
 *  that the user can extend so they don't have to write
 *  it themselves.
 *
 *  NB:  this does not provide any scaffolding, the user will
 *  need to write their own templates for this to work at
 *  the moment.
 *
 */

class Smutty_Controller_Session extends Smutty_Controller {

	function loginAction( $data, $session ) {

		$router = Smutty_Router::getInstance();

		if ( $session->user )
			$this->redirect(array(
				controller => $router->getDefaultControllerName()
			));

		$this->view();

	}

	function logoutAction( $data, $session ) {

		$router = Smutty_Router::getInstance();

		if ( $session->user )
			$session->user->logout();

		$this->redirect(array(
			controller => $router->getDefaultControllerName()
		));

	}

}

?>